package com.yiwyn.controller;

import com.yiwyn.domain.Test;
import com.yiwyn.domain.Teste;
import com.yiwyn.service.ConsumerService;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.concurrent.ExecutionException;

@RestController
public class ConsumerController {

    @Resource
    private ConsumerService consumerService;


    @PostMapping("/test")
    public String test(HttpServletRequest request, Teste teste, @RequestBody Test test) throws ExecutionException, InterruptedException {
        String name = request.getParameter("name");
        System.out.println(teste);
        System.out.println(test);
        System.out.println(name);
        return consumerService.test();
    }


}
